package top.yangbuyi.repertory.tyh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import top.yangbuyi.repertory.tyh.domain.RepertoryCell;
import top.yangbuyi.repertory.tyh.mapper.RepertoryCellMapper;
import top.yangbuyi.repertory.tyh.service.RepertoryCellService;

@Service
public class RepertoryCellServiceImpl extends ServiceImpl<RepertoryCellMapper, RepertoryCell> implements RepertoryCellService {

    @Autowired
    private RepertoryCellMapper repertoryCellMapper;

    /**
     * 获取需要审核的安全库存配置单
     */
    @Override
    public List<RepertoryCell> getRepertoryCell() {
        QueryWrapper<RepertoryCell> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id")
              .eq("check_tag","S001-1");
        return repertoryCellMapper.selectList(queryWrapper);
    }

      /**
       * 获取所有安全库存配置单
       */
    @Override
    public List<RepertoryCell> getRepertoryCellAll() {
          QueryWrapper<RepertoryCell> queryWrapper = new QueryWrapper<>();
          queryWrapper.orderByDesc("id")
                .in("check_tag","S001-1","S001-2","S001-3");
          return repertoryCellMapper.selectList(queryWrapper);
    }

      /**
     * 制定安全库存配置单
     */
      @Override
    public void addCell(RepertoryCell repertoryCell) {
        repertoryCellMapper.insert(repertoryCell);
    }

      /**
       * 复核配置单
       */
      @Override
      public void updRepertoryCell(RepertoryCell repertoryCell){
            repertoryCellMapper.updRepertoryCell(repertoryCell);
      }

      /**
       * 变更配置单
       */
      @Override
      public void changeRepertoryCell(RepertoryCell repertoryCell){
            repertoryCellMapper.changeRepertoryCell(repertoryCell);
      }

}

